package com.bitters.core.controller;

import com.bitters.core.handler.ServerExceptionHandlerGroup;
import com.bitters.enums.Calcable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author thomashe
 * @date 2023/10/20/ 16:38
 * @description 只拦截某一类型的异常信息Controller类
 */
@ServerExceptionHandlerGroup
@RestController
@RequestMapping("/cust")
public class ServerExceptionController {

    @GetMapping("/{id}")
    public String foo(@PathVariable("id") Integer id) {
        Integer i = 1 / id;
        message(th -> {
            9, 1
        });
        return null;
    }


    public void message(Calcable calcable) {
        System.out.println(calcable.calc(x));
    }
}
